home *** CD-ROM | disk | FTP | other *** search
File List | 1990-11-13 | 8.0 KB | 233 lines |
- Rem Multi-Disk, Multi-Drive Formatting Utility V.1.0
- Rem By Bob Retelle, December 1987
- '
- Rem Written for the Michigan Atari Magazine
- Rem 3487 Braeburn Circle, Ann Arbor, MI 48108
- '
- Rem Requires GFA BASIC and TWO disk drives
- '
- Restart:
- Rez=Xbios(4) ! Rez=0=Low Rez, Rez=1=Medium Rez, Rez=2=High Rez
- If Rez=0
- Alert 0," Sorry, the Formatter| will only work in|MED or HIGH resolution..!",1,"Drat!",Button
- End
- Endif
- '
- Drv%=1 !Start with Drive A (will be reversed first time through)
- Fat%=5 !5 File allocation table sectors allocated
- Di%=112 !112 directory entried allowed
- Disks%=1 !Count how many disks have been formatted
- '
- Defline 1,5
- Deftext 1,0,0,6 !For Hi Rez: 1,0,0,13
- '
- Gosub Makemouse !Customize mouse pointer
- Gosub Credits
- Gosub Choices
- Gosub Warning
- '
- Disk%=Disk%-(Auto=3) !If Option 3 is chosen, start with a count of 2
- '
- Do !Main program loop
- If Auto=3 !Format both drives simultaneously
- Drv%=0
- Gosub Prompt2
- Gosub Format
- Gosub Prompt3
- Inc Disks%
- Key=Asc(A$)
- Goto Action
- Endif
- Drv%=Abs(Drv%=0) !Alternate Drives
- If Auto=2 !Option 2, automatic alternating of drives
- Gosub Prompt
- Print Chr$(7); !Ring the bell
- Gosub Format
- Goto Action
- Endif
- '
- Cls !Option 1, prompted alternating of drives
- Print Chr$(7); !Ring the bell
- A$=" Drive A"
- If Drv%
- A$=" Drive B"
- Endif
- Alert 0," Ready to FORMAT|"+A$+"|Insert new disk and| press RETURN",1,"FORMAT|Abort",Button
- If Button=2
- Goto Abort
- Endif
- Gosub Prompt
- Gosub Format
- '
- Action:
- If Key=27 !Quit if ESC has been pressed
- Goto Abort
- Endif
- Inc Disks% !Count total disks formatted
- Loop
- '
- Abort:
- Cls
- Alert 0," All done? ",1,"Yes/Quit|Restart",Key
- If Key=2
- Clear
- Goto Restart
- Endif
- End
- Rem ################ CREDITS procedure ###################
- Procedure Credits !HI REZ:
- Rbox 100,20,540,170 !100,20,540,290
- Text 188,45,"MULTI-DRIVE, MULTI-DISK FORMATTER" !188,50
- Text 260,65,"By Bob Retelle" !260,89
- Text 156,85,"Written with GFA BASIC, the GFA BASIC BOOK" !156,133
- Text 228,95,"the GFA BASIC COMPANION" !228,155
- Text 196,115,"Requires TWO floppy disk drives" !196,199
- Text 204,125,"either Single or Double sided" !204,221
- Text 292,145,"V. 1.0" !292,265
- Repeat
- A$=Inkey$
- K=Mousek
- Until K=1 Or Asc(A$) !Wait until mouse button or key is pressed
- Pause 10
- Cls
- Return
- Rem ################ CHOICES procedure ###################
- Procedure Choices
- Alert 0," Do you want to|Format with 9 or 10|sectors per track?",1,"-9-|-10-",Button
- Rem Change this number to 2 to default to 10 Sectors per Track ^
- Spt%=9-(Button=2)
- '
- Alert 0," Do you want to|format with 80 or 82| tracks per disk?",1,"-80-|-82-",Button
- Rem Change this number to 2 to default to 82 Tracks per disk ^
- Trk%=80-2*(Button=2)
- '
- Alert 0,"Do you want to|format Single or|Double sided?",1,"SINGLE|DOUBLE",Button
- Rem Change this number to 2 to default to Double Sided ^
- Sid%=1-(Button=2)
- '
- Alert 0," Do you want PROMPTED,| CONTINUOUS or SIMULTANEOUS| formatting?",1,"PROMPT|CONT|SIMUL",Auto
- Return
- Rem ################ WARNING procedure ###################
- Procedure Warning !HI REZ:
- Rbox 100,20,540,170 !100,20,540,320
- Text 220,35,"*** STANDARD WARNING ***" !220,40
- Text 244,65,"FROM THIS POINT ON" !244,89
- Text 284,75,"* ANY *" !244,111
- Text 212,85,"DISK IN EITHER DRIVE A OR B" !212,133
- Text 284,95,"WILL BE" !284,155
- Text 276,105,"* ERASED *" !276,199
- Text 196,125,"BE SURE THAT YOU HAVE REMOVED YOUR" !196,121
- Text 274,135,"PROGRAM DISK" !274,243
- Text 168,145,"AND ARE READY TO PROCEED WITH FORMATTING" !168,265
- Text 258,155,"YOUR BLANK DISKS" !258,287
- Wait: !Wait until mouse button is pressed, or any key press
- Repeat
- A$=Inkey$
- K=Mousek
- Until K=1 Or Asc(A$)
- Pause 10
- Cls
- Return
- Rem ###################PROMPT PROCEDURE##############
- Procedure Prompt !HI REZ:
- Rbox 150,20,490,140 !150,20,490,260
- Text 232,45,"INSERT NEW DISK INTO" !232,57
- D$="DRIVE A"
- If Drv%=0
- D$="DRIVE B"
- Endif
- Text 286,55,D$ !286,79
- Text 232,75,"SO IT CAN BE FORMATTED" !232,123
- Text 254,85,"WHEN THE DISK IN" !254,145
- A$="DRIVE B"
- If Drv%=0
- A$="DRIVE A"
- Endif
- Text 286,95,A$ !286,167
- Text 272,105,"IS FINISHED" !272,189
- Text 244,115,"(PRESS ESC TO QUIT)" !244,211
- Text 224,125,"Total disks formatted="+Str$(Disks%) !224,233
- Return
- Procedure Prompt2
- Cls
- Rbox 150,20,490,85 !150,20,490,140
- Text 262,45," **STAND BY**" !262,57
- Text 222,65,"NOW FORMATTING BOTH DRIVES" !221,101
- Return
- Procedure Prompt3
- Cls
- Rbox 150,20,490,85 !150,20,490,140
- Text 272,45,"SWITCH DISKS" !272,57
- Text 222,55,"PRESS ANY KEY TO CONTINUE" !222,79
- Text 244,65,"(PRESS ESC TO QUIT)" !244,101
- Repeat
- Print Chr$(7);
- A$=Inkey$
- Pause 15
- Until Asc(A$)
- Return
- Rem ##################### FORMAT PROCEDURE #####################
- Procedure Format !Based on GFA BASIC Book from MichTron
- X=55-24*(Rez=2) !Position for printing message
- Buf$=String$(20000,0) !Buffer to hold Boot Sector info
- Void Fre(0) !Make sure String doesn't move
- Buf%=Varptr(Buf$) !Find start of buffer
- For T%=0 To Trk%-1
- For S%=0 To Sid%-1
- If Auto=3
- Drv%=0
- Endif
- Print At(28,18);"Formatting Side ";S%+1;", Track ";T%;" ";
- If Auto<>3
- If T%/2=Int(T%/2) !Flash next Drive message
- Text 286,X,D$
- Else
- Text 286,X," "
- Endif
- Endif
- Otherdrive:
- E%=Xbios(10,L:Buf%,L:0,Drv%,Spt%,T%,S%,1,L:&H87654321,0) !Format call
- If E%
- Print At(26,19);"Error formatting Side ";S%+1;" Track ";T%;
- Endif
- If Auto=3 And Drv%=0
- Drv%=1
- Goto Otherdrive
- Endif
- Next S%
- Next T%
- Gosub Boot
- If Auto=3
- Drv%=0
- Gosub Boot
- Endif
- Key=Asc(Inkey$)
- Return
- Procedure Boot
- Rem Create Boot Sector information in Buffer$
- Sec%=Trk%*Spt%*Sid%
- Buf$=String$(6,0)+Mkl$(Xbios(17))+Chr$(0)+Mki$(2)+Chr$(2)
- Buf$=Buf$+Mki$(&H100)+Chr$(2)+Chr$(Di%)+Chr$(Di%/256)
- Buf$=Buf$+Chr$(Sec%)+Chr$(Sec%/256)+Chr$(Med%)
- Buf$=Buf$+Mki$(Fat%*256)+Mki$(Spt%*256)+Mki$(Sid%*256)
- Buf$=Buf$+Mki$(0)+String$(512,0)
- Void Xbios(9,L:Varptr(Buf$),L:0,Drv%,1,0,0,1)
- Void Bios(7,Drv%)
- Buf$=Mkl$(&HF7FFFF00)+String$(508,0)
- Void Bios(4,1,L:Varptr(Buf$),1,1,Drv%)
- Void Bios(4,1,L:Varptr(Buf$),1,Fat%+1,Drv%)
- Return
- Rem ############ MAKE MOUSE PROCEDURE ###############
- Rem From Mouse Editor provided with GFA BASIC
- Procedure Makemouse
- Let Mouse$=Mki$(0)+Mki$(3)+Mki$(1)
- Let Mouse$=Mouse$+Mki$(0)+Mki$(1)
- For I%=1 To 32
- Read Byte
- Let Mouse$=Mouse$+Mki$(Byte)
- Next I%
- Data 7224,8184,8184,32190,24570,32766,4080,4080,8184,16380,16380,16380,16376,8176,4092,2044
- Data 2064,3120,4080,3504,16380,2016,2016,2016,4080,8184,8184,8184,4080,2016,512,1016
- Defmouse Mouse$
- Return
-